import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

public class TcpDicServer extends TcpEchoServer{
    private Map<String,String> dict=new HashMap<>();

    public TcpDicServer(int port) throws IOException {
        super(port);

        dict.put("dog","狗");
        dict.put("cat","猫");
        dict.put("pig","猪");
    }
    @Override
    public String process(String request){
        return dict.getOrDefault(request,"没有查到该单词！");
    }
    public static void main(String[] args) throws IOException {
        TcpDicServer tcpDicServer=new TcpDicServer(9090);
        tcpDicServer.start();
    }
}
